import request from '@/utils/request';

export async function fetch(params: any) {
  return request('/roles/list', {
    params,
  });
}

export async function batchDelete(params: any) {
  return request('/roles/batch-del', {
    method: 'delete',
    data: params,
  });
}

export async function addOrUpdate(params: any) {
  return request(`/roles/save/${params.id}`, {
    method: 'post',
    data: params,
  });
}


export async function saveMenus(params: any) {
  return request(`/roles/${params.id}/menus-save`, {
    method: 'put',
    data: params,
  });
}

export async function fetchAllMenus() {
  return request('/roles/all-menus');
}

export async function fetchRoleMenus(params: any) {
  return request(`/roles/${params.id}/menus`);
}
